/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.ly.wxstore.web;

import java.util.HashMap;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresRoles;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ly.wxstore.entity.goods.Goods;

/**
 * 商城controller
 * 
 * @author peter
 */
@Controller
@RequestMapping(value = "/Cart")
public class CartController {


	private static Logger logger = LoggerFactory.getLogger(CartController.class);
	
	
	
	@RequestMapping(value="userInfolist.json",method = RequestMethod.GET)
	@ResponseBody
	public Map<String,String> list() {
		Map<String,String> map = new HashMap<String, String>();
		map.put("name", "张三");
		map.put("isSaler", "否");
		map.put("createDate", "2015-06-15");
		map.put("id", "22580");
		return map;
	}
	
	/**
	 * 添加到购物车
	 * @param goodsId
	 * @return
	 */
	@RequiresRoles("user")
	@RequestMapping(value="addToCart/{goodsId}.json",method = RequestMethod.GET)
	@ResponseBody
	public boolean addToCart(@PathVariable("goodsId") Long goodsId) {
		logger.info("addToCart："+goodsId);
		
		return true;
	}

}
